import request from '@/config/axios'

export interface DeliveryPickUpStoreVO {
  id: number
  name: string
  introduction: string
  phone: string
  areaId: number
  detailAddress: string
  logo: string
  openingTime: string
  closingTime: string
  latitude: number
  longitude: number
  status: number
  pointsIds: number[] // 绑定积分编号组数
  storeImages: string // 店铺详情图1
  detailImage: string // 店铺详情图2
  type: number
}

// 查询自提门店列表
export const getDeliveryPickUpStorePage = async (params: any) => {
  return await request.get({ url: '/trade/life-circle/store/page', params })
}

// 查询自提门店详情
export const getDeliveryPickUpStore = async (id: number) => {
  return await request.get({ url: '/trade/life-circle/store/get?id=' + id })
}

// 查询自提门店精简列表
export const getSimpleDeliveryPickUpStoreList = async (): Promise<DeliveryPickUpStoreVO[]> => {
  return await request.get({ url: '/trade/life-circle/store/simple-list' })
}

// 新增自提门店
export const createDeliveryPickUpStore = async (data: DeliveryPickUpStoreVO) => {
  return await request.post({ url: '/trade/life-circle/store/create', data })
}

// 修改自提门店
export const updateDeliveryPickUpStore = async (data: DeliveryPickUpStoreVO) => {
  return await request.put({ url: '/trade/life-circle/store/update', data })
}

// 删除自提门店
export const deleteDeliveryPickUpStore = async (id: number) => {
  return await request.delete({ url: '/trade/life-circle/store/delete?id=' + id })
}

// 绑定自提店员
export const bindStoreStaffId = async (data: any) => {
  return await request.post({ url: '/trade/life-circle/store/bind', data })
}

// 查询积分列表
export const getPointsList = (params: PageParam) => {
  return request.get({ url: '/trade/life-circle/store/getPointsList', params })
}

// 查询店铺类型列表
export const getStoreTypes = () => {
  return request.get({ url: '/trade/life-circle/store/getTypeList' })
}
// 绑定店铺积分
export const bindStore = async (data: any) => {
  return await request.post({ url: '/trade/life-circle/store/bind', data })
}

// 编辑店铺积分
export const bindEditStore = async (data: any) => {
  return await request.post({ url: '/trade/life-circle/store/bind-edit', data })
}
